﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Fintech.Utils;
using ZOVNP.Model;
using ZOVNP.Model.Abstracts;
using ZOVNP.WinView.Utils;

namespace ZOVNP.WinView
{
    public partial class SellerMainControl : UserControl, ISaveSupportable
    {
        #region static
        //private static IEnumerable<IOrdersTreePopulationStrategy> _ordersTreePopulationStrategies;

        //static SellerMainControl()
        //{
        //    //var list = new List<IOrdersTreePopulationStrategy>();
        //    //list.Add(new PlainOrdersTreePopulationStrategy());
        //    //list.Add(new MonthlyOrdersTreePopulationStrategy());
        //    //_ordersTreePopulationStrategies = list;
        //}

        #endregion
        

        public SellerMainControl(Workspace workspace)
        {
            Workspace = workspace;

            InitializeComponent();
            CustomInitializations();
            //LoadData();
        }

        internal readonly Workspace Workspace;
        
        private void CustomInitializations()
        {
            tcTabs.TabPages.Add(new SellerOrdersTabPage(this));
            tcTabs.TabPages.Add(new SellerCustomersTabPage(this));

            ((SellerTabPage)tcTabs.SelectedTab).Initialize();
        }

        public void Save()
        {
            ((SellerTabPage) tcTabs.SelectedTab).Save();
        }

        public void Add()
        {
            ((SellerTabPage)tcTabs.SelectedTab).Add();
        }

        public void Edit()
        {
            ((SellerTabPage)tcTabs.SelectedTab).Edit();
        }

        public void Delete()
        {
            ((SellerTabPage)tcTabs.SelectedTab).Delete();
        }

        public void Refresh()
        {
            ((SellerTabPage)tcTabs.SelectedTab).RefreshData();
        }

        public void Print()
        {
            ((SellerTabPage)tcTabs.SelectedTab).Print();
        }

        private void TabsSelectedIndexChanged(object sender, EventArgs e)
        {
            ((SellerTabPage)tcTabs.SelectedTab).Initialize();
        }
    }
}
